﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// NotReviewedButNeeded
#pragma once
#include <cstdint>
namespace gcmp
{
    /// \brief 事务错误码
    enum class NdbTransactionError : uint32_t
    {
        NO                            = 0,           ///< 没有错误，成功。
        // 事务相关错误
        ADD_BEYOND_TRANSACTION        = 1 << 0,      ///< 不允许在事务外增加对象
        MODIFY_BEYOND_TRANSACTION     = 1 << 1,      ///< 不允许在事务外修改对象
        DELETE_BEYOND_TRANSACTION     = 1 << 2,      ///< 不允许在事务外删除对象
        UNDO_IN_TRANSACTION           = 1 << 3,      ///< 不允许在事务过程中Undo
        REDO_IN_TRANSACTION           = 1 << 4,      ///< 不允许在事务过程中Redo
        BEGIN_TRANSACTION_CONTINOUSLY = 1 << 5,      ///< 当前事务还未结束不允许开始新事务
        COMMIT_BEYOND_TRANSACTION     = 1 << 6,      ///< 不允许在事务外提交
        ROLLBACK_BEYOND_TRANSACTION   = 1 << 7,      ///< 不允许在事务外回滚
        ROLLBACK_FAIL                 = 1 << 8,      ///< 回滚事务失败
        BEGIN_GROUP_WITHIN_TRANS      = 1 << 9,      ///< 当前事务还未结束不允许开始事务组
        COMMIT_GROUP_WITHIN_TRANS     = 1 << 10,     ///< 当前事务还未结束不允许提交事务组
        ROLLBACK_GROUP_WITHIN_TRANS   = 1 << 11,     ///< 当前事务还未结束不允许回滚事务组
        COMMIT_EMPTY_TRANSACTION      = 1 << 12,     ///< 提交空事务
        // 事务组相关错误
        COMMIT_GROUP_BEYOND_GROUP    = 1 << 13,      ///< 提交事务组时没有活动的事务组
        ROLLBACK_GROUP_BEYOND_GROUP  = 1 << 14,      ///< 回滚事务组时没有活动的事务组
        ROLLBACK_GROUP_INACTIVE      = 1 << 15,      ///< 回滚的指定事务组不处于活动状态
        // 事务相关的构件协同错误
        LOAD_BEYOND_TRANSACTION      = 1 << 16,      ///< 不允许在事务外加载对象
        UNLOAD_BEYOND_TRANSACTION    = 1 << 17,      ///< 不允许在事务外卸载对象
    };
}
